package uutalk.netcloud.talk.app.ui.adapter;

import android.content.Intent;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import uutalk.netcloud.talk.R;
import uutalk.netcloud.talk.app.Constants;
import uutalk.netcloud.talk.app.ui.ContentActivity;
import uutalk.netcloud.talk.model.bean.FriendInfoBean;

/**
 * 类描述：
 * 作者：Pengmutian
 * 时间：2018/5/11
 */
public class SigleAdapter extends BaseQuickAdapter<FriendInfoBean , BaseViewHolder> {
    public SigleAdapter(List data) {
        super(R.layout.item_sigle, data);
    }
    @Override
    protected void convert(BaseViewHolder helper, FriendInfoBean item) {
        helper.setText(R.id.tvName, item.getFriend_name());
        final String userID = item.getFriend_id();
        if("1".equals(item.getFriend_status())){
            helper.setVisible(R.id.tvOnLine, true);
            helper.setVisible(R.id.tvOffLine, false);
        } else {
            helper.setVisible(R.id.tvOnLine, false);
            helper.setVisible(R.id.tvOffLine, true);
        }
        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, ContentActivity.class);
                intent.putExtra(Constants.KEY_FRAGMENT, Constants.USER_INFO_FRAGMENT);
                intent.putExtra(Constants.KEY_UID, userID);
                mContext.startActivity(intent);
            }
        });
    }
}
